<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/elec/elecStation.js"></script>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return'<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>设备管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>出场设置</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });

</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <div class="columns pull-left">
                        <h5 class="font-bold">出场设置</h5>
                    </div>
                    <div class="ibox-tools">
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="frmElecStationOut">
                        <input id="elecStationId" name="elecStationId" value="${elecStationId}"
                               type="hidden">
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">出场方式：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="outType" id="outType">
                                    <option value="0"
                                            <c:if test="${elecStationOut.outType eq '0'}">selected</c:if> >无道闸
                                    </option>
                                    <option value="1"
                                            <c:if test="${elecStationOut.outType eq '1'}">selected</c:if> >无道闸,收费,减免
                                    </option>
                                    <option value="2"
                                            <c:if test="${elecStationOut.outType eq '2'}">selected</c:if> >有道闸,不收费
                                    </option>
                                    <option value="3"
                                            <c:if test="${elecStationOut.outType eq '3'}">selected</c:if> >有道闸,对接道闸减免
                                    </option>
                                    <option value="4"
                                            <c:if test="${elecStationOut.outType eq '4'}">selected</c:if> >有道闸,默认减免
                                    </option>
                                    <option value="5"
                                            <c:if test="${elecStationOut.outType eq '5'}">selected</c:if> >
                                        有道闸,人工减免(无需小票)
                                    </option>
                                    <option value="6"
                                            <c:if test="${elecStationOut.outType eq '6'}">selected</c:if> >有道闸,收费,不免
                                    </option>
                                    <option value="7"
                                            <c:if test="${elecStationOut.outType eq '7'}">selected</c:if> >有道闸,小票减免
                                    </option>
                                    <option value="8"
                                            <c:if test="${elecStationOut.outType eq '8'}">selected</c:if> >
                                        商米扫码(有道闸,小票减免)
                                    </option>
                                    <option value="9"
                                            <c:if test="${elecStationOut.outType eq '9'}">selected</c:if> >按互联互通
                                    </option>
                                    <option value="10"
                                            <c:if test="${elecStationOut.outType eq '10'}">selected</c:if> >不对外,专用桩
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">打印机类型：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="printerType" id="printerType">
                                    <option value="0"
                                            <c:if test="${elecStationOut.printerType eq '0'}">selected</c:if> >无打印机
                                    </option>
                                    <option value="1"
                                            <c:if test="${elecStationOut.printerType eq '1'}">selected</c:if> >小票打印机
                                    </option>
                                    <option value="2"
                                            <c:if test="${elecStationOut.printerType eq '2'}">selected</c:if> >二维码打印机
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">是否免费2个小时停车：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="isFreeParking" id="isFreeParking">
                                    <option value="0"
                                            <c:if test="${elecStationOut.isFreeParking eq '0'}">selected</c:if> >是
                                    </option>
                                    <option value="1"
                                            <c:if test="${elecStationOut.isFreeParking eq '1'}">selected</c:if> >否
                                    </option>
                                    <option value="2"
                                            <c:if test="${elecStationOut.isFreeParking eq '1'}">selected</c:if> >部分减免
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">是否必须车牌号：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="isNeedNumber" id="isNeedNumber">
                                    <option value="0"
                                            <c:if test="${elecStationOut.isNeedNumber eq '0'}">selected</c:if> >是
                                    </option>
                                    <option value="1"
                                            <c:if test="${elecStationOut.isNeedNumber eq '1'}">selected</c:if> >否
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">出场提示文案：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="hint" name="hint"
                                       value="${elecStationOut.hint}">
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">备注：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="remark" name="remark"
                                       value="${elecStationOut.remark}">
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">出场图片1：</label>
                            <div class="col-sm-8">
                                <div id="">
                                    <c:choose>
                                        <c:when test="${elecStationOut.outImage1!=null && elecStationOut.outImage1!=''}">
                                            <div id="">
                                                <img id="outImage1" src="${uploadPath}${elecStationOut.outImage1}"
                                                     width="155px" height="120px">
                                                <input type="file" id="file1" name="file1"/>
                                            </div>
                                        </c:when>
                                        <c:otherwise>
                                            <div id="">
                                                <img id="outImage1" src="${ctx}/statics/img/upload-img.png"
                                                     style="position: relative" width="155px" height="120px">
                                                <input type="file" id="file1" name="file1"/>
                                            </div>
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                                <span>图片尺寸建议为：<span class="text-danger">98px*75px</span></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">出场图片2：</label>
                            <div class="col-sm-8">
                                <div id="">
                                    <c:choose>
                                        <c:when test="${elecStationOut.outImage2!=null && elecStationOut.outImage2!=''}">
                                            <div id="">
                                                <img id="stationImg2" src="${uploadPath}${elecStationOut.outImage2}"
                                                     width="155px" height="120px">
                                                <input type="file" id="file2" name="file2"/>
                                            </div>
                                        </c:when>
                                        <c:otherwise>
                                            <div id="">
                                                <img id="stationImg2" src="${ctx}/statics/img/upload-img.png"
                                                     style="position: relative" width="155px" height="120px">
                                                <input type="file" id="file2" name="file2"/>
                                            </div>
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                                <span>图片尺寸建议为：<span class="text-danger">98px*75px</span></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">出场图片3：</label>
                            <div class="col-sm-8">
                                <div id="">
                                    <c:choose>
                                        <c:when test="${elecStationOut.outImage3!=null && elecStationOut.outImage3!=''}">
                                            <div id="">
                                                <img id="stationImg3" src="${uploadPath}${elecStationOut.outImage3}"
                                                     width="155px" height="120px">
                                                <input type="file" id="file3" name="file3"/>
                                            </div>
                                        </c:when>
                                        <c:otherwise>
                                            <div id="">
                                                <img id="stationImg3" src="${ctx}/statics/img/upload-img.png"
                                                     style="position: relative" width="155px" height="120px">
                                                <input type="file" id="file3" name="file3"/>
                                            </div>
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                                <span>图片尺寸建议为：<span class="text-danger">98px*75px</span></span>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-3 col-sm-offset-8 text-right">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">


    /**************************/
    $("#file1").change(function () {
        var objUrl = getObjectURL(this.files[0]);//获取文件信息
        if (objUrl) {
            $("#outImage1").attr("src", objUrl);
        }
    });

    $("#file2").change(function () {
        var objUrl = getObjectURL(this.files[0]);//获取文件信息
        if (objUrl) {
            $("#outImage2").attr("src", objUrl);
        }
    });

    $("#file3").change(function () {
        var objUrl = getObjectURL(this.files[0]);//获取文件信息
        if (objUrl) {
            $("#outImage3").attr("src", objUrl);
        }
    });

    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) {
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }

    /*************************/


    elecStationOut.init();
</script>
</body>
</html>